/***********************************************************************************File        : Table3_dewalque.do Authors     : Ariel Dora Stern & Nick MenziesCreated     : 25 Apr 2010Modified    : 27 Apr 2010Description : Compile DHS Data for Gov 2001 Paper***********************************************************************************/set mem 800m
cd "/Users/Ariel/Dropbox/Gov2001/dewalque"
set more off


global dwp = "outreg yearsofeduc urban currentmarried formermarried morethanonemarriage polygamous protestant muslim othereligion earthfloorall using t4.out, se bracket append"
global dwiv = "outreg yearsofeduc urban currentmarried formermarried morethanonemarriage polygamous protestant muslim othereligion earthfloorall using t3.out, se bracket append"



*************
* BURKINA *
*************


use "shortburkinaforappend.dta"
compress

*linear model:
		
regress hivpositive yearsofeduc urban ///
	currentmarried formermarried widow ///
	morethanonemarriage polygamous protestant ///
	muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall ///
	electricityall refrigeratorall _I* ///
	[pweight= weight]  if male==1, vce (cluster cluster)
	
regress hivpositive yearsofeduc urban ///
	currentmarried formermarried widow ///
	morethanonemarriage polygamous protestant ///
	muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall ///
	electricityall refrigeratorall _I* ///
	[pweight= weight]  if male==0, vce (cluster cluster)


*probit model: 

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow ///
	morethanonemarriage polygamous protestant ///
	muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall ///
	electricityall refrigeratorall i.age i.radioteleall ///
	i.transportall i.region i.ethny ///
	[pweight= ivweight]  if male==1, vce(cluster cluster)

outreg yearsofeduc urban currentmarried formermarried widow morethanonemarriage polygamous protestant muslim othereligion earthfloorall using t4.out, se bracket replace
 
xi: dprobit hivpositive yearsofeduc urban  ///
	currentmarried formermarried  widow ///
	morethanonemarriage polygamous protestant ///
	muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall ///
	electricityall refrigeratorall i.age i.radioteleall /// 
	i.transportall i.region i.ethny ///
	[pweight= ivweight]  if male==0, vce(cluster cluster)

$dwp 

* IV model

xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow ///
	morethanonemarriage polygamous protestant ///
	muslim othereligion  (earthfloorall = pitlatrineall ///
	flushedorimprovedlatrineall electricityall refrigeratorall ///
	i.radioteleall  i.transportall) i.age  i.region i.ethny ///
	[pweight= ivweight]  if male==1, vce(cluster cluster) 
outreg yearsofeduc urban currentmarried formermarried widow morethanonemarriage polygamous protestant muslim othereligion earthfloorall using t3.out, se bracket replace	

	
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow ///
	morethanonemarriage polygamous protestant ///
	muslim othereligion  (earthfloorall = pitlatrineall ///
	flushedorimprovedlatrineall electricityall refrigeratorall ///
	i.radioteleall  i.transportall) i.age  i.region i.ethny ///
	[pweight= ivweight]  if male==0, vce(cluster cluster) 
$dwiv

*************
* CAMEROON *
*************

use "shortcameroonforappend.dta", clear

*Linear Model

regress hivpositive yearsofeduc urban /// 
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region i.ethny [pweight= ivweight]  if male==1, vce(cluster cluster)
	
regress hivpositive yearsofeduc urban /// 
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region i.ethny [pweight= ivweight]  if male==0, vce(cluster cluster)

*probit model

xi: dprobit hivpositive yearsofeduc urban /// 
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region i.ethny [pweight= ivweight]  if male==1, vce(cluster cluster)
$dwp
xi: dprobit hivpositive yearsofeduc urban /// 
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region i.ethny [pweight= ivweight]  if male==0, vce(cluster cluster)
$dwp
*IV model

xi: ivreg hivpositive  yearsofeduc urban /// 
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  (earthfloorall = ///
	pitlatrineall flushedorimprovedlatrineall electricityall ///
	refrigeratorall i.radioteleall  i.transportall) i.age  i.region ///
	i.ethny [pweight= ivweight]  if male==1, vce(cluster cluster) 
$dwiv

xi: ivreg hivpositive  yearsofeduc urban /// 
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  (earthfloorall = ///
	pitlatrineall flushedorimprovedlatrineall electricityall ///
	refrigeratorall i.radioteleall  i.transportall) i.age  i.region ///
	i.ethny [pweight= ivweight]  if male==0, vce(cluster cluster)  
$dwiv

*********
* GHANA *
*********
use "shortghanaforappend.dta", clear
compress
*widow & ethnicity dummies are not in this data set for some reason... 

*Linear Model

regress hivpositive yearsofeduc urban ///
	currentmarried formermarried morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	[pweight= ivweight]  if male==1, vce(cluster cluster)

regress hivpositive yearsofeduc urban ///
	currentmarried formermarried morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	[pweight= ivweight]  if male==0, vce(cluster cluster)

*probit model

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	[pweight= ivweight]  if male==1, vce(cluster cluster)
$dwp

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	[pweight= ivweight]  if male==0, vce(cluster cluster)
$dwp

*IV model 
 
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried morethanonemarriage ///
	polygamous protestant muslim othereligion  (earthfloorall = ///
	pitlatrineall flushedorimprovedlatrineall electricityall ///
	refrigeratorall i.radioteleall  i.transportall) i.age  ///
	i.region [pweight= ivweight]  if male==1, vce(cluster cluster)
$dwiv
 
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried morethanonemarriage ///
	polygamous protestant muslim othereligion  (earthfloorall = ///
	pitlatrineall flushedorimprovedlatrineall electricityall ///
	refrigeratorall i.radioteleall  i.transportall) i.age  ///
	i.region [pweight= ivweight]  if male==0, vce(cluster cluster)
$dwiv

*********
* KENYA *
*********

use "shortkenyaforappend.dta", clear
compress

*Linear Model*

regress hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	i.ethny [pweight= ivweight]  if male==1, vce(cluster cluster)

regress hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	i.ethny [pweight= ivweight]  if male==0, vce(cluster cluster) 

*Probit Model

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	i.ethny [pweight= ivweight]  if male==1, vce(cluster cluster) 
$dwp
xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  widow morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall i.region ///
	i.ethny [pweight= ivweight]  if male==0, vce(cluster cluster) 
$dwp

*IV Model
 
xi: ivreg hivpositive yearsofeduc urban  currentmarried ///
	formermarried  widow morethanonemarriage polygamous ///
	protestant muslim othereligion  (earthfloorall = ///
	pitlatrineall flushedorimprovedlatrineall electricityall ///
	refrigeratorall i.radioteleall  i.transportall) i.age  ///
	i.region i.ethny [pweight= ivweight]  if male==1, vce(cluster cluster) 
$dwiv
 
xi: ivreg hivpositive yearsofeduc urban  currentmarried ///
	formermarried  widow morethanonemarriage polygamous ///
	protestant muslim othereligion  (earthfloorall = ///
	pitlatrineall flushedorimprovedlatrineall electricityall ///
	refrigeratorall i.radioteleall  i.transportall) i.age  ///
	i.region i.ethny [pweight= ivweight]  if male==0, vce(cluster cluster)   
$dwiv

************
* TANZANIA *
************

use "shorttanzaniaforappend.dta", clear
compress

*Linear Model

regress hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight]  if male==1, vce(cluster cluster)   
	
regress hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight]  if male==0, vce(cluster cluster)   

*Probit Model

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight]  if male==1, vce(cluster cluster)  
$dwp
 
xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight]  if male==0, vce(cluster cluster)  
$dwp

*IV Model 
 
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion ///
	(earthfloorall = pitlatrineall flushedorimprovedlatrineall ///
	electricityall refrigeratorall i.radioteleall  i.transportall) ///
	i.age  i.region [pweight= ivweight]  if male==1, vce(cluster cluster)  
$dwiv
 
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion ///
	(earthfloorall = pitlatrineall flushedorimprovedlatrineall ///
	electricityall refrigeratorall i.radioteleall  i.transportall) ///
	i.age  i.region [pweight= ivweight]  if male==0, vce(cluster cluster)   
$dwiv

****COMBINED

use "5countriespooledshort.dta", clear
compress

*Probit Model

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight] if male==1, vce(cluster cluster)  
$dwp
 
xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight]  if male==0, vce(cluster cluster)  
$dwp

xi: dprobit hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion  pitlatrineall ///
	flushedorimprovedlatrineall earthfloorall electricityall ///
	refrigeratorall i.age i.radioteleall i.transportall ///
	i.region [pweight= ivweight], vce(cluster cluster)  
$dwp

*IV Model 
 
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion ///
	(earthfloorall = pitlatrineall flushedorimprovedlatrineall ///
	electricityall refrigeratorall i.radioteleall  i.transportall) ///
	i.age  i.region [pweight= ivweight]  if male==1, vce(cluster cluster)  
$dwiv
 
xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion ///
	(earthfloorall = pitlatrineall flushedorimprovedlatrineall ///
	electricityall refrigeratorall i.radioteleall  i.transportall) ///
	i.age  i.region [pweight= ivweight]  if male==0, vce(cluster cluster)   
$dwiv

xi: ivreg hivpositive yearsofeduc urban ///
	currentmarried formermarried  morethanonemarriage ///
	polygamous protestant muslim othereligion ///
	(earthfloorall = pitlatrineall flushedorimprovedlatrineall ///
	electricityall refrigeratorall i.radioteleall  i.transportall) ///
	i.age  i.region [pweight= ivweight], vce(cluster cluster)   
$dwiv



*Probit Model - Simplified - Causally prior
gen ped = yearsofeduc >=6
gen hed = yearsofeduc >=10 
gen rel = protestant ==1 | muslim ==1 | othereligion ==1
gen rel_ed = rel*ped

xi: dprobit hivpositive yearsofeduc protestant muslim othereligion ///
	i.region [pweight= ivweight] if male==1, vce(cluster cluster)  
outreg using t6.out, se bracket replace bdec(4)
xi: dprobit hivpositive yearsofeduc protestant muslim othereligion ///
	i.region [pweight= ivweight] if male==0, vce(cluster cluster)  
outreg using t6.out, se bracket append bdec(4)
xi: dprobit hivpositive yearsofeduc protestant muslim othereligion ///
	i.region [pweight= ivweight], vce(cluster cluster)  
outreg using t6.out, se bracket append bdec(4)

xi: dprobit hivpositive ped protestant muslim othereligion ///
	i.region [pweight= ivweight] if male==1, vce(cluster cluster)  
outreg using t62.out, se bracket replace bdec(4)
xi: dprobit hivpositive ped protestant muslim othereligion ///
	i.region [pweight= ivweight] if male==0, vce(cluster cluster)  
outreg using t62.out, se bracket append bdec(4)
xi: dprobit hivpositive ped protestant muslim othereligion ///
	i.region [pweight= ivweight], vce(cluster cluster)  
outreg using t62.out, se bracket append bdec(4)

xi: dprobit hivpositive ped protestant muslim othereligion i.region [pweight= ivweight], vce(cluster cluster) 
outreg using t7.out, se bracket replace bdec(4)
xi: dprobit hivpositive ped protestant muslim othereligion i.region [pweight= ivweight] if age >=15 & age <=30, vce(cluster cluster)  
outreg using t7.out, se bracket append bdec(4)
xi: dprobit hivpositive ped protestant muslim othereligion i.region [pweight= ivweight] if age >30 & age <=45, vce(cluster cluster) 
outreg using t7.out, se bracket append bdec(4)

xi: dprobit hivpositive hed protestant muslim othereligion i.region [pweight= ivweight], vce(cluster cluster) 
outreg using t72.out, se bracket replace bdec(4)
xi: dprobit hivpositive hed protestant muslim othereligion i.region [pweight= ivweight] if age >=15 & age <=30, vce(cluster cluster)  
outreg using t72.out, se bracket append bdec(4)
xi: dprobit hivpositive hed protestant muslim othereligion i.region [pweight= ivweight] if age >30 & age <=45, vce(cluster cluster) 
outreg using t72.out, se bracket append bdec(4)

